<template>
	<uv-popup
		ref="baseConfirmPopup"
		bgColor="transparent"
		:closeOnClickOverlay="false"
		:safeAreaInsetBottom="false"
	>
		<view class="base-confirm-content">
			<view class="title">{{ title }}</view>
			<view class="content" :class="[contentAlign]">{{ content }}</view>
			<view class="button">
				<view v-if="showCancel" class="btn" @click="cancel">{{ cancelText }}</view>
				<view class="btn confirm" @click="confirm">{{ confirmText }}</view>
			</view>
		</view>
	</uv-popup>
</template>

<script>
export default {
	props: {
		title: {
			type: String,
			default: '温馨提示'
		},
		content: String,
		contentAlign: String,
		showCancel: {
			type: Boolean,
			default: true
		},
		cancelText: {
			type: String,
			default: '取消'
		},
		confirmText: {
			type: String,
			default: '确认'
		}
	},
	methods: {
		open () {
			this.$refs.baseConfirmPopup.open()
		},
		close () {
			this.$refs.baseConfirmPopup.close()
		},
		cancel () {
			this.close()
			this.$emit('cancel')
		},
		confirm () {
			this.close()
			this.$emit('confirm')
		}
	}
}
</script>

<style lang="scss" scoped>
@import './index.scss';
</style>